package net.fromtech.frame.controller;


import net.fromtech.frame.core.AjaxResult;
import net.fromtech.frame.core.exception.BaseException;
import net.fromtech.frame.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 关注公众号：MarkerHub
 * @since 2020-11-01
 */
@RestController
@RequestMapping("/sys-user")
public class SysUserController {
    @Autowired
    SysUserService sysUserService;

    @GetMapping("/{id}")
    public AjaxResult test(@PathVariable("id") Long id) {
        return AjaxResult.success(sysUserService.getById(id));
    }

    /**
     * 测试异常
     * @return
     */
    @GetMapping("/exp")
    public AjaxResult exp(){
        throw new BaseException("出错了！！！");
    }

}
